package org.dromara.system.utils;

import jodd.util.StringUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum ProductAchievementFieldEnum {

    FIELD1("materialRemark","物料描述"),
    FIELD3("contractId","合同编号"),
    FIELD4("itemName","项目名称"),
    FIELD401("unit","计量单位"),
    FIELD5("contractStartTime","合同生效日期"),
    FIELD501("actualSupplied","实际供货数量");

    private final String field;
    private final String fieldName;

    public static ProductAchievementFieldEnum findByFieldName(String fieldName) {
        if (StringUtil.isBlank(fieldName)) {
            return null;
        }
        for (ProductAchievementFieldEnum type : values()) {
            if (type.fieldName.equals(fieldName.replaceAll("\\s*|\r|\n|\t",""))) {
                return type;
            }
        }
        return null;
    }

}
